package edu.pku.dao;

import java.sql.SQLException;
import java.util.List;

import com.ibatis.sqlmap.client.SqlMapClient;

import edu.pku.data.SellForm;
import edu.pku.util.MySqlMapClient;

public class SellFormDao {
	
	public void addSellForm(SellForm sf) throws SQLException
	{
		SqlMapClient sqlMap = MySqlMapClient.getSqlMapInstance();
		sqlMap.insert("insert_sell_form",sf);
	}
	
	public void updateSellForm(SellForm sf) throws SQLException
	{
		SqlMapClient sqlMap = MySqlMapClient.getSqlMapInstance();
		sqlMap.update("update_sell_form",sf);
	}
	
	public List<SellForm> getSellForms(String companyName) throws SQLException
	{
		SqlMapClient sqlMap = MySqlMapClient.getSqlMapInstance();
		List<SellForm> list =  sqlMap.queryForList("get_sell_forms",companyName);
		return list;
	}
	
	public void deleteSellForm(SellForm sf) throws SQLException
	{
		SqlMapClient sqlMap = MySqlMapClient.getSqlMapInstance();
		sqlMap.delete("delete_sell_form",sf);
	}
	
	
}
